package view;

import model.Pacman;
import java.awt.*;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;

public class PacmanView {
    private Pacman pacman;
    private Image image;

    public PacmanView(Pacman pacman) {
        this.pacman = pacman;
        try {
            this.image = ImageIO.read(new File("images/pacman.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void draw(Graphics g, int tileSize) {
        if (image != null) {
            g.drawImage(image, pacman.getCol() * tileSize, pacman.getRow() * tileSize, tileSize, tileSize, null);
        } else {
            g.setColor(Color.YELLOW);
            g.fillArc(pacman.getCol() * tileSize, pacman.getRow() * tileSize, tileSize, tileSize, 30, 300);
        }
    }
} 